home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-07 | 3.6 KB | 137 lines | [TEXT/MPS ] |
- (*
- stepVideo n,m - Step the display n frames, and do it m times.
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w stepVideo.p
-
- link -m ENTRYPOINT -o HyperCommands -rt XCMD=8007 -sn Main=stepVideo ∂
- stepVideo.p.o "{MPW}"Libraries:interface.o "{MPW}"PLibraries:PasLib.o
-
- Copyright © 1987,88 Apple Computer, Inc.
-
- 9/87 - Initial coding by Harry R. Chesley.
- 2/88 - Changed for new interface specification by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S stepVideo } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- type
-
- Str31 = String[31];
-
- procedure stepVideo(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- stepVideo(paramPtr);
- end;
-
- procedure stepVideo(paramPtr: XCmdPtr);
-
- var numberOfParms: integer; { Number of input parameters. }
- stepSize: longInt; { How many frames to step at each iteration. }
- repeatCount: longInt; { How many times to iterate. }
- iter: longInt; { Iteration index. }
- stepIter: integer; { Interation step index. }
- blankSearch: boolean; { Whether to blank on searches. }
- theFrame: longInt; { With big jumps, the current frame number. }
- str: str255; { Misc. string. }
- oldMode: str255; { The old frame/chapter/time mode. }
-
- {$I XCmdGlue.inc}
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(errMsg);
- exit(stepVideo);
- end;
-
- {$I VideoUtil.inc}
-
- begin
- numberOfParms := paramPtr^.paramCount;
- if numberOfParms > 2 then Fail('parameter count is not 0-2');
-
- { Get the step size. }
- if numberOfParms > 0 then stepSize := GetLongParm(1)
- else stepSize := 1;
- if stepSize = 0 then stepSize := 1;
-
- { Get the repeat count. }
- if numberOfParms > 1 then repeatCount := GetLongParm(2)
- else repeatCount := 1;
-
- { Remember the old mode and change to frame mode. }
- GetStrGlobal('videoMode',oldMode);
- if oldMode = '' then oldMode := 'frameMode';
- videoCmd('control','frameMode');
-
- { If we're hopping, get the current frame number. }
- if (stepSize > 9) or (stepSize < -9) then
- begin
- { Clear out any pending input. }
- EvalAndDispose('recvUpTo(empty,0,empty)');
- { Get the frame number. }
- str := videoFunc('frame','');
- if StringEqual(str,'noAnswer') then
- begin
- videoCmd('control',oldMode);
- Fail('noAnswer');
- end;
- theFrame := StrToLong(str);
- end;
-
- { Remember the blanking. }
- GetStrGlobal('blankNextVideo',str);
- blankSearch := str <> '';
-
- for iter := 1 to repeatCount do
- begin
- { Step it... }
- if (stepSize >= 1) and (stepSize <= 9) then
- begin
- if blankSearch then videoCmd('control','pictureOff');
- for stepIter := 1 to stepSize do videoCmd('step','1');
- if blankSearch then videoCmd('control','pictureOn');
- end
- else if (stepSIze <= -1) and (stepSize >= -9) then
- begin
- if blankSearch then videoCmd('control','pictureOff');
- for stepIter := 1 to -stepSize do videoCmd('step','-1');
- if blankSearch then videoCmd('control','pictureOn');
- end
- else
- begin
- { If we were blanking, make sure the global is still set. }
- if blankSearch then SetStrGlobal('blankNextVideo','true');
- { Get the next frame in the sequence. }
- theFrame := theFrame + stepSize;
- if theFrame < 0 then leave;
- { Search to it. }
- videoCmd('search',LongToStr(theFrame));
- end;
- end;
-
- { Clear out blanking. }
- SetStrGlobal('blankNextVideo','');
-
- { Restore the mode. }
- videoCmd('control',oldMode);
- end;
-
- end.
-